package com.example.serviceloader;

import java.util.Iterator;
import java.util.ServiceLoader;

public class Main {

    public static void main(String[] args) {
        ServiceLoader<MyInterface> load = ServiceLoader.load(MyInterface.class);

        Iterator<MyInterface> iterator = load.iterator();
        while (iterator.hasNext()){
            MyInterface next = iterator.next();
            System.out.println(next);

        }

        ServiceLoader<MyInterface2> load1 = ServiceLoader.load(MyInterface2.class);
        Iterator<MyInterface2> iterator1 = load1.iterator();

        while (iterator1.hasNext()){
            MyInterface2 next = iterator1.next();
            System.out.println(next);
        }


    }


}
